//Accepted
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

int n, i, r=0, x;
char s[100002];

void process(){
	n=strlen(s);
	if(n==1){
		printf("0");
		return;
	}
	
	while(n!=1){
	x=(s[0]-'0');
	for(i=1;i<n;i++)x+= s[i]-'0';
	r++;
	
	sprintf(s, "%d", x);
	n=strlen(s);
	}
	
	printf("%d", r);
}
int main(){
	//freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
	scanf("%s",s);
	process();
	return 0;
}
